package com.sun.local.analysis;

import cn.hutool.core.io.FileUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static com.sun.common.constants.Constant.SSQ_FILE_PATH;

/**
 * 2024年所有出现过的和值
 */
public class AnalysisSum {

    public static void main(String[] args) {
        List<Integer> numList = new ArrayList<>();
        // 读取文件数据
        List<String> ssqList = FileUtil.readUtf8Lines(SSQ_FILE_PATH);
        for (String ssq : ssqList) {
            // 年份 例：2023-08-31
            String year = ssq.substring(0, 4);
            if(StringUtils.equals("2024", year)) {
                String sum = StringUtils.substringBetween(ssq, "SUM=", "|").trim();
                numList.add(Integer.valueOf(sum));
            }
        }
        Collections.sort(numList);
        for (Integer num : numList) {
            System.out.println(num);
        }
    }

}
